package com.tepth.appmanageservice.protocol.bodys.login;

import com.tepth.appmanageservice.protocol.Index;
import com.tepth.appmanageservice.protocol.interfaces.IReceive;
import com.tepth.appmanageservice.tools.ext.ExtToDate;
import com.tepth.appmanageservice.tools.ext.ExtToInt;

import java.util.Date;

public class ClientLoginReply implements IReceive {
	public static final short ID = 0x0C01;

	private short reply_serial_number;
	private short reply_id;
	private byte value;
	private Date dateTime;

	public short getId() {
		return ID;
	}

	public short getReply_serial_number() {
		return this.reply_serial_number;
	}

	public void setReply_serial_number(byte reply_serial_number) {
		this.reply_serial_number = reply_serial_number;
	}

	public short getReply_id() {
		return this.reply_id;
	}

	public void setReply_id(short reply_id) {
		this.reply_id = reply_id;
	}

	public byte getValue() {
		return this.value;
	}

	public void setValue(byte value) {
		this.value = value;
	}

	public Date getDateTime() {
		return this.dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

	@Override
	public short getLength() {
		return 0;
	}

	@Override
	public void setLength(int length) {

	}

	@Override
	public void Receive(byte[] data, Index index) {
		this.reply_serial_number = ExtToInt.fromByteArrayTo16(data, index);
		this.value = data[index.get()];
		this.dateTime = ExtToDate.fromByteArray(data, index);
	}
}